<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body{
            height: 5000px;
        }
        div{
            width: 100px;
            height: 100px;
            background-color: #0077aa;
            position: absolute;
            left: 0;
            top: 0;
        }
    </style>
    <script>
        window.onload = function () {

            window.onmousemove = function (event) {
                var x = event.clientX;
                var y = event.clientY;
                alert(event);
                var div = document.getElementsByTagName('div')[0];
                // console.log(div);
                // div.style.left = (x-50)+'px';
                // div.style.top = (y-50)+'px';
                div.style.left = x+'px';
                div.style.top = y+'px';
            }
        }
    </script>
</head>
<body>
<div></div>
</body>
</html>